package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.ProductCategory;
import com.weipai.springboot.model.api.Tree;
import com.weipai.springboot.module.dao.ProductCategoryDao;
import com.weipai.springboot.module.mapper.ProductCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/09/12 10:58
 */
@Repository
public class ProductCategoryDaoImpl implements ProductCategoryDao{

    @Autowired
    ProductCategoryMapper productCategoryMapper;
    
    @Override
    public int getProductCategoryByName(String productCategoryName) {
        return productCategoryMapper.getProductCategoryByName(productCategoryName);
    }

    @Override
    public Integer getProductId(String id) {
        return productCategoryMapper.getProductId(id);
    }

    @Override
    public int insert(ProductCategory productCategory) {
        return productCategoryMapper.insert(productCategory);
    }

    @Override
    public int updateByPrimaryKey(ProductCategory productCategory) {
        return productCategoryMapper.updateByPrimaryKeySelective(productCategory);
    }

    @Override
    public ProductCategory getProductCategoryById(String id) {
        return productCategoryMapper.getProductCategoryById(id);
    }

    @Override
    public List<ProductCategory> selectAllByRankDel(int del, String rank, String sort, String way, String id) {
        return productCategoryMapper.selectAllByRankDel(del, rank, sort, way, id);
    }

    @Override
    public Integer getValidChildCountById(String id) {
        return productCategoryMapper.getValidChildCountById(id);
    }

    @Override
    public int updateStatus(String id, Integer status) {
        return productCategoryMapper.updateStatus(id, status);
    }

    @Override
    public List<ProductCategory> getAllProductCategory() {
        return productCategoryMapper.getAllProductCategory();
    }


    @Override
    public List<Tree> getAllProductCategoryV2() {
        return productCategoryMapper.getAllProductCategoryV2();
    }

    @Override
    public List<ProductCategory> getChildCategory(String pid) {
        return productCategoryMapper.getChildCategory(pid);
    }

    @Override
    public List<Map<String, Object>> getCategoryBrands(String id) {
        return productCategoryMapper.getCategoryBrands(id);
    }

    @Override
    public List<Map<String, Object>> getSearchPropertyByCategory(String id) {
        return productCategoryMapper.getSearchPropertyByCategory(id);
    }

    @Override
    public List<ProductCategory> getThirdCategoryByTopId(String id) {
        return productCategoryMapper.getThirdCategoryByTopId(id);
    }

    @Override
    public int batchDeleteById(String[] id) {
        return productCategoryMapper.batchDeleteById(id);
    }

    @Override
    public List<Map<String,Object>> getProductCategoryByPid(String parentId) {
        return productCategoryMapper.getProductCategoryByPid(parentId);
    }


}
